/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
import clsx from 'clsx';
import Heading from '@theme/Heading';
import ShowcaseCard from '../Card';

import styles from './styles.module.css';

import Infrastructure,{type InfrastructureItem } from '@site/src/data/infrastructure';


function HeadingNoResult() {
  return (
    <Heading as="h2">
      暂无数据
    </Heading>
  );
}

function NoResultSection() {
  return (
    <section className="margin-top--lg margin-bottom--xl">
      <div className="container padding-vert--md text--center">
        <HeadingNoResult />
      </div>
    </section>
  );
}

export default function ShowcaseCards() {

  if (Infrastructure?.length === 0) {
    return <NoResultSection />;
  }
  return (
    <section className="margin-top--lg margin-bottom--xl">
      <div className="container">
        <ul className={clsx('clean-list', styles.cardList)}>
          {Infrastructure?.length && (
            <>
              {Infrastructure.map((community, index) => (
                <ShowcaseCard item={community} key={index} />
              ))}
            </>
          )}
        </ul>
      </div>
    </section>
  );
}
